import math

"""
math is a module. A module is just a collection of variables (a namespace, if you like) 
defined by someone else.

 We can see all the names in math using the built-in function dir().
"""
print("It's math! It has type {}".format(type(math)))
print(dir(math))

# simple values
print("pi to 4 significant digits = {:.4}".format(math.pi))
# functions
print(math.log(32, 2))

import math as mt

print(mt.pi)

"""
Wouldn't it be great if we could refer to all the variables in the math module by themselves? 
i.e. if we could just refer to pi instead of math.pi or mt.pi? 
Good news: we can do that.
"""
from math import *

print(pi, log(32, 2))

"""
from math import *
from numpy import *
print(pi, log(32, 2))
errors happen

The problem in this case is that the math and numpy modules both have functions called log, 
but they have different semantics. 
Because we import from numpy second, 
its log overwrites (or "shadows") the log variable we imported from math.

from math import log, pi
from numpy import asarray
"""

import numpy as np

rolls = np.random.randint(low=1, high=6, size=10)

print(rolls)

print(type(rolls))
print(dir(rolls))
# print(help(rolls))

print(rolls.mean)
print(help(rolls.ravel))
